/*
*    Phantom Test Driver v2.0 GUI Automation Software
*    Copyright (C) 2009  John C. Van Arsdall (john@phantomtest.com)
*
*    This program is free software; you can redistribute it and/or modify
*    it under the terms of the GNU General Public License as published by
*    the Free Software Foundation; either version 2 of the License, or
*    (at your option) any later version.
*
*    This program is distributed in the hope that it will be useful,
*    but WITHOUT ANY WARRANTY; without even the implied warranty of
*    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*    GNU General Public License for more details.
*
*    You should have received a copy of the GNU General Public License along
*    with this program; if not, write to the Free Software Foundation, Inc.,
*    51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
*/
/*
 * PTDSuiteThread.java
 *
 * Created on January 1, 2006, 7:12 PM
 *
 * To change this template, choose Tools | Options and locate the template under
 * the Source Creation and Management node. Right-click the template and choose
 * Open. You can then make changes to the template in the Source Editor.
 */

package ptd;

import ptd_suite_objects.SuiteRunBase;

/**
 *
 * @author John
 */
public class PTDSuiteThread extends java.lang.Thread{
    
    private SuiteRunBase myBase;
    private PTDDisplay myDisp;
    private PTDScriptComm myComm;
    private PTDRemoteMachine myMachine;
    private boolean isRemote = false;
    
    /** Creates a new instance of PTDSuiteThread */
    public PTDSuiteThread() {
    }
    
    public void init(SuiteRunBase inBase, PTDDisplay inDisp, PTDScriptComm inComm){
        myDisp = inDisp;
        myComm = inComm;
        myBase = inBase;
    }

    public void initRemote(SuiteRunBase inBase, PTDDisplay inDisp, PTDScriptComm inComm, PTDRemoteMachine Machine){
        myDisp = inDisp;
        myComm = inComm;
        myBase = inBase;
        myMachine = Machine;
        isRemote = true;
    }    
    
    public void run(){
        if(isRemote){
            Main.debug_out("Starting remote thread...");
            myBase.run(myDisp, myComm, true, myMachine);
            myMachine.setCurrentStatus("Finished");
            myMachine.runState = false;
        }else{
            Main.getMainFrame().setSuiteRunning(true);
            Main.debug_out("Starting suite thread...");
            myBase.run(myDisp, myComm, false, null);
            Main.getMainFrame().setSuiteRunning(false);
        }
    }

    
}
